from dataclasses import dataclass
from typing import List, Optional

@dataclass
class VipIconUrl:
    """VIP图标URL信息"""
    iconConfig: str
    nightIconConfig: str
    jumpUrl: str
    type: int
    width: int

@dataclass
class UserInfoResponse:
    """用户信息响应"""
    Code: int
    Msg: str
    Data: Optional['UserInfoData']
    TipType: int
    
    @classmethod
    def from_dict(cls, data: dict):
        """从字典创建响应对象"""
        response_data = None
        if data.get('Data'):
            response_data = UserInfoData.from_dict(data.get('Data'))
        
        return cls(
            Code=data.get('Code'),
            Msg=data.get('Msg'),
            Data=response_data,
            TipType=data.get('TipType')
        )

@dataclass
class UserInfoData:
    """用户信息数据"""
    vipIconUrls: List[VipIconUrl]
    darkVipIconUrls: List
    bindApiKey: bool
    UserId: int
    NickName: str
    NickNameModifyTip: str
    Mobile: str
    Balance: float
    BalanceMoney: str
    TotalMoney: float
    BlockMoney: float
    preSellTitle: Optional[str]
    PurchaseMoney: float
    PurchaseBlockMoney: float
    UnReadSiteMsgNum: int
    Avatar: str
    ApiKey: str
    TransactionUrl: str
    RealName: str
    IdCard: str
    SteamId: str
    InventoryStatus: bool
    OnlyWithDrawMoney: float
    Area: str
    SteamTradeStatus: int
    TradeStatusExpireTime: Optional[str]
    SteamTradeStatusTip: str
    TradeStatusRefreshTimeTip: str
    SteamJumpUrl: Optional[str]
    BizType: int
    AuthStatus: int
    
    @classmethod
    def from_dict(cls, data: dict):
        """从字典创建数据对象"""
        vip_icon_urls = []
        for icon_data in data.get('vipIconUrls', []):
            vip_icon_urls.append(VipIconUrl(
                iconConfig=icon_data.get('iconConfig'),
                nightIconConfig=icon_data.get('nightIconConfig'),
                jumpUrl=icon_data.get('jumpUrl'),
                type=icon_data.get('type'),
                width=icon_data.get('width')
            ))
        
        return cls(
            vipIconUrls=vip_icon_urls,
            darkVipIconUrls=data.get('darkVipIconUrls', []),
            bindApiKey=data.get('bindApiKey'),
            UserId=data.get('UserId'),
            NickName=data.get('NickName'),
            NickNameModifyTip=data.get('NickNameModifyTip'),
            Mobile=data.get('Mobile'),
            Balance=data.get('Balance'),
            BalanceMoney=data.get('BalanceMoney'),
            TotalMoney=data.get('TotalMoney'),
            BlockMoney=data.get('BlockMoney'),
            preSellTitle=data.get('preSellTitle'),
            PurchaseMoney=data.get('PurchaseMoney'),
            PurchaseBlockMoney=data.get('PurchaseBlockMoney'),
            UnReadSiteMsgNum=data.get('UnReadSiteMsgNum'),
            Avatar=data.get('Avatar'),
            ApiKey=data.get('ApiKey'),
            TransactionUrl=data.get('TransactionUrl'),
            RealName=data.get('RealName'),
            IdCard=data.get('IdCard'),
            SteamId=data.get('SteamId'),
            InventoryStatus=data.get('InventoryStatus'),
            OnlyWithDrawMoney=data.get('OnlyWithDrawMoney'),
            Area=data.get('Area'),
            SteamTradeStatus=data.get('SteamTradeStatus'),
            TradeStatusExpireTime=data.get('TradeStatusExpireTime'),
            SteamTradeStatusTip=data.get('SteamTradeStatusTip'),
            TradeStatusRefreshTimeTip=data.get('TradeStatusRefreshTimeTip'),
            SteamJumpUrl=data.get('SteamJumpUrl'),
            BizType=data.get('BizType'),
            AuthStatus=data.get('AuthStatus')
        )
